home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / wgt35.zip / WGTSB.DOC < prev    next >
Text File  |  1993-01-28  |  7KB  |  248 lines

  1. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2.             WGT v3.5 SoundBlaster Routines
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4.  
  5. VOC - Digital Sample Routines
  6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. Global Variables:
  8.  
  9. int sbintnum;        Sbintnum is the interrupt number the SB runs on.
  10.              Valid IRQs are 2, 3, 5 and 7 (default factory setting).
  11.  
  12. int sbioaddr;        Sbioaddr is the I/O address the SB is installed at.
  13.              Valid entries are 0x210, 0x220 (factory default),
  14.              0x230, 0x240, 0x250, and 0x260
  15.  
  16. unsigned int sbstat;  Status of the SB while playing VOC files
  17.               0 - VOC not playing or recording
  18.               255- VOC is playing or recording
  19.               1-254- VOC marker found (?)
  20.  
  21. typedef char far * wgtvoice;    A simple way to remember and use VOC files.
  22.                 Use:     wgtvoice mysound;
  23.                 (results in a pointer called mysound)
  24.  
  25.  
  26.  
  27. int winitsb(void)
  28. ----------------------------------------------------------------------
  29. Attempts to initialize the SoundBlaster at the address in sbioaddr,
  30. and interrupt sbintnum.
  31.  
  32. Returns:
  33.     -1 if CT-VOICE could not be loaded from the current directory
  34.     -2 if SB could not reset correctly
  35.      0 if everything is alright
  36.  
  37. Also sets up the sbstat variable to update when the SoundBlaster
  38. VOC state changes.
  39.  
  40.  
  41.  
  42. int wsbversion(void)
  43. ---------------------------------------------------------------------
  44. Returns:
  45.     Version number of your SoundBlaster driver.
  46.  
  47.  
  48.  
  49. void waddr(int base)
  50. ---------------------------------------------------------------------
  51.     Changes the I/O address used by SB routines.
  52.  
  53.  
  54.  
  55.  
  56. void wirq(int irq)
  57. ---------------------------------------------------------------------
  58.     Changes the interrupt number used by SB routines.
  59.  
  60.  
  61.  
  62.  
  63. void wdeinitsb(void)
  64. ---------------------------------------------------------------------
  65.     Deinitializes the SoundBlaster driver.
  66.  
  67.  
  68.  
  69.  
  70. void wsetspeaker(int onoff)
  71. ---------------------------------------------------------------------        
  72.     Turns SB speaker on or off (0 is off, 1 is on). It is best to
  73. turn the speaker off when sampling from the input port because garbled
  74. sound will be heard otherwise.
  75.  
  76.  
  77.  
  78.  
  79. void wplayvoc(wgtvoice buffer)
  80. ---------------------------------------------------------------------        
  81.     Plays a previously loaded VOC file.
  82. You can store multiple VOC files in memory at once, by making different
  83. wgtvoice variables, and loading different VOC files into them.
  84. Sbstat is set to 255 while playing, and resets to 0 when the VOC is
  85. finished.
  86.     If a VOC is already playing, nothing will happen when you
  87. call this routine.  Use wstopvoc to stop current sounds, and then
  88. wplayvoc to start a new one.
  89.  
  90.  
  91.  
  92.  
  93. void wsample(wgtvoice buffer, long length)
  94. ---------------------------------------------------------------------
  95.     Records a raw sample from the SB input device.
  96. Use newvoice to allocate memory for the voice data if you haven't
  97. loaded one into the buffer variable yet.
  98.  
  99. eg:        hello=wnewvoice(23456);    /* allocate 23456 bytes for sample */
  100.        wsample(hello,23456);      /* Sample into buffer      */
  101.  
  102.  
  103.  
  104.  
  105. void wstopvoc(void)
  106. ---------------------------------------------------------------------        
  107.     Stops playback of a VOC file (if one is currently playing). 
  108.  
  109.  
  110.  
  111.  
  112. void wpausevoc(void)
  113. ---------------------------------------------------------------------        
  114.     Pauses playback of a VOC file. Can be used in conjunction with
  115. wresumevoc to implement a pause feature in a program.
  116.  
  117.  
  118.  
  119.  
  120. void wresumevoc(void)
  121. ---------------------------------------------------------------------
  122.     Resumes playback of a VOC file. Playback of a VOC will resume
  123. at the point where wpausevoc was called.
  124.  
  125.  
  126.  
  127.  
  128. void wfreevoc(wgtvoice vocname)
  129. ---------------------------------------------------------------------
  130.     Frees memory used by a VOC file which was either sampled,
  131. or loaded in from disk.
  132.  
  133.  
  134.  
  135.  
  136. wgtvoice wnewvoice(long size)
  137. ---------------------------------------------------------------------
  138.     Allocates memory for a new sample to be recorded using wsample.
  139. This is only required if you will be using wsample, as the wloadvoc
  140. automatically reserves the proper amount of memory.
  141.  
  142.  
  143.  
  144.  
  145. wgtvoice wloadvoc(char *name)
  146. ---------------------------------------------------------------------
  147.     Loads a VOC file into a wgtvoice variable.  This will allocate
  148. the memory and read in the file.
  149. eg:
  150.         wgtvoice hello, world;       /* Declare pointers */
  151.         hello=wloadvoc("hello.voc"); /* Load first VOC   */
  152.         world=wloadvoc("world.voc"); /* Load another VOC */
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  160.                   FM Sound Routines
  161. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  162. Global Variables:
  163.  
  164. typedef char far * wgtsong;     Simple way remember a CMF song.
  165.  
  166. unsigned char fmstat;   Status of the FM playing routines.
  167.             0- not playing (Your song has finished)
  168.             255 Song is playing
  169.             1-254 Song marker found
  170.  
  171. int fmint;              Current FM interrupt being used by SBFMDRV.COM
  172.             The SBFMDRV driver reports this value when installed.
  173.  
  174.  
  175.  
  176.  
  177. void wfmsetstatus(unsigned ofs,unsigned seg);
  178. ---------------------------------------------------------------------
  179.     Sets status variable of FM routines.
  180.     fmstat is automatically set by wfindfm, but you may want to change
  181.     it to your own variable.
  182. eg:
  183.     fmsetstatus(FP_OFF(&mystat),FP_SEG(&mystat));
  184.  
  185.  
  186.  
  187.  
  188. unsigned wfmversion(void);
  189. ---------------------------------------------------------------------
  190.     Returns the FM driver version number.
  191.  
  192.  
  193.  
  194.  
  195. void wfmreset(void);
  196. ---------------------------------------------------------------------
  197.     Resets the FM driver. Should be called before any FM output is
  198. initiated by the program.
  199.  
  200.  
  201.  
  202.  
  203. void wfmstopmusic(void);
  204. ---------------------------------------------------------------------
  205.     Stops the song which is currently playing.
  206.  
  207.  
  208.  
  209.  
  210. void wfmsongspeed(unsigned ss);
  211. ---------------------------------------------------------------------
  212.     Changes the tempo of the song. We're not really sure what
  213. the number represents exactly, but the average setting is around 20000,
  214. and the lower you get the faster the song plays. Do NOT play songs too
  215. quickly or the driver may malfunction. This may also cause VOCs to
  216. freeze, or disable them entirely. Keep values above 2000 or so to
  217. ensure your programs stability.
  218.  
  219.  
  220.  
  221.  
  222. int wfindfm(void);
  223. ---------------------------------------------------------------------        
  224.     Searches the interrupts to find out if SBFMDRV.COM has been
  225. loaded, and initializes the status variable fmstat. Returns 0 if the
  226. driver is installed, or a -1 if it is not.
  227.  
  228.  
  229.  
  230.  
  231. void wplaycmf(wgtsong song);
  232. ---------------------------------------------------------------------
  233.     Plays a previously loaded CMF file. VOC files may be played
  234. simultaneously with CMF songs, so you may have FM and digital sound.
  235. Sets fmstat to 255 while song is playing.
  236.  
  237.  
  238.  
  239.  
  240. wgtsong wloadcmf(char *loadfile);
  241. ---------------------------------------------------------------------
  242.     Allocates memory and loads a CMF file.
  243. You can load multiple CMF files similar to the method of loading multiple
  244. VOC files. Memory is automatically allocated for you.
  245.  
  246.  
  247.  
  248.